package com.ocom.devicehttp.feign.machine;

import com.alibaba.fastjson.JSONObject;
import com.ocom.common.constant.PayConfigUrl;
import com.ocom.common.constant.PayHandleUrl;
import com.ocom.common.entity.card.EntityXfRecord;
import com.ocom.common.request.payhandle.*;
import com.ocom.common.resp.RespMachMessage;
import com.ocom.common.resp.Result;
import com.ocom.common.vo.pay.FaceErrVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Map;

@FeignClient(value = "payhandle")
public interface PayoperFeignService {

    @GetMapping(PayHandleUrl.URL_PayHandle_GetDeviceFlag)
    public RespMachMessage getDeviceFlag(@RequestParam("companyId")Long companyId, @RequestParam("machNo") String machNo, @RequestParam("versionCode") String versionCode);

    @PostMapping(PayHandleUrl.URL_PayHandle_GetMachPara)
    public Result getMachPara(@RequestBody Map<String,Object> map);

    //更改设备参数状态
    @PostMapping(PayHandleUrl.URL_PayHandle_ChangeMachParaState)
    public Result changeMachParaState(@RequestBody Map<String,Object> map);


    /**
     * 2.8.1 付款码支付请求（qrCodePay）
     */
    @PostMapping(PayHandleUrl.URL_PayHandle_qrCodePay)
    public Result qrCodePay(@RequestBody QrCodePayRequest request);

    /**
     * 付款码订单查询（qrCodeQuery）
     */
    @PostMapping(PayHandleUrl.URL_PayHandle_qrCodeQuery)
    public Result qrCodeQuery(@RequestBody QrCodeQueryRequest request);

    /**
     * 交易中撤单
     */
    @PostMapping(PayHandleUrl.URL_PayHandle_qrCodeCancel)
    public Result qrCodeCancel(@RequestBody QrCodeQueryRequest request);

    /**
     * 付款码退款
     */
    @PostMapping(PayHandleUrl.URL_PayHandle_qrCodeRefund)
    public Result qrCodeRefund(@RequestBody QrCodeRefundRequest request);

    /**
     * 设备消费记录
     */
    @PostMapping(PayHandleUrl.URL_machBillList)
    public Result machBillList(@RequestBody QrCodeBillListRequest request);

    /**
     * 设备消费记录
     */
    @PostMapping(PayHandleUrl.URL_machDailySummary)
    public Result machDailySummary(@RequestBody QrCodeMachDailySummaryRequest request);

    @PostMapping(PayHandleUrl.getPayCard)
    public Result getPayCard(@RequestBody  QrCardPayRequest request);

    /**
     * 消费记录
     */
//    @PostMapping(PayHandleUrl.saveXfRecord)
//    public Result saveXfRecord(@RequestBody  TradeRecordRequest request);

    /**
     * 在线订单查询
     */
    @PostMapping(PayHandleUrl.URL_OnlinePayQuery)
    public Result onlinePayQuery(@Valid @RequestBody QrCodeQueryRequest request);

    //白名单下发
    @PostMapping(value = PayHandleUrl.URL_getXFWhiteList)
    public RespMachMessage changeWhiteListState(@Valid @RequestBody Map<String, Object> map);

    //白名单下发结果通知
    @PostMapping(value = PayHandleUrl.URL_getXFWhiteListResult)
    public RespMachMessage getXFWhiteListResult(@Valid @RequestBody Map<String, Object> map);

    //余额查询
    @PostMapping(value = PayHandleUrl.URL_getBalance)
    public RespMachMessage getBalance(@Valid @RequestBody Map<String, Object> map);

    //获取风控参数
    @PostMapping(value = PayHandleUrl.URL_getMachFk)
    public RespMachMessage getMachFk(@RequestParam("companyId")Long companyId,@RequestParam("machNo")String machNo);


    //风控参数更新结果
    @PostMapping(value = PayHandleUrl.URL_changeFkState)
    public RespMachMessage changeFkState(@RequestParam("companyId")Long companyId,@RequestParam("machNo")String machNo,@RequestParam("jobId")String jobId);



    @PostMapping(PayHandleUrl.URLP_PayConfig_GetMerchInfoByMachNo)
    public Result GetMerchInfoByMachNo(@RequestParam("comId") Long comId,@RequestParam("machNo") String machNo);



    @PostMapping(PayHandleUrl.URL_faceErrRecode)
    public Result faceErrRecode(@RequestBody FaceErrVo faceErrVo);

    //充值请求（onlineDeposit）
    @PostMapping(PayHandleUrl.URL_onlineDeposit)
    public Result onlineDeposit(@RequestBody RechargeCardRequest request);

    @PostMapping(PayHandleUrl.URL_verifyPassword)
    public Result verifyPassword(@RequestParam("companyId") Long companyId,@RequestParam("pId") Long pId,@RequestParam("password") String password);


    @PostMapping(PayHandleUrl.URL_WX_Authinfo)
    public Result WXAuthinfo(@RequestBody AuthinfoRequest request);

    @PostMapping(value = PayHandleUrl.URL_getPersonByPhone)
    public RespMachMessage getPersonByPhone(@RequestParam("comId")Long comId,@RequestParam("phone") String phone);

    @PostMapping(PayHandleUrl.URL_getDishesWhiteList)
    public Result getDishesWhiteList(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo
            , @RequestParam("listLimit") Integer listLimit) ;

    //2.11.2 更改菜品白名单状态（changeDishesWhiteState）
    @PostMapping(PayHandleUrl.URL_changeDishesWhiteState)
    public Result changeDishesWhiteState(@RequestParam("companyId")Long companyId, @RequestParam("machNo") String machNo);

    @PostMapping(PayHandleUrl.URL_PayHandle_GetMachParaTwo)
    public Result getMachParaTwo(@RequestBody Map<String,Object> map);


    @PostMapping(value = PayHandleUrl.URL_getBalancePhone)
    public RespMachMessage getBalancePhone(@RequestBody Map<String, Object> map);


    @PostMapping(value = PayHandleUrl.URL_PayHandle_RegisterInf)
    public Result registerInf(@RequestBody RegisterPersonRequest request);

    @PostMapping(value = PayHandleUrl.URL_PayHandle_SendSMS)
    public Result sendSMS(@RequestBody InvitedSmsRequest smsRequest);

    //支付宝离线
    @PostMapping(PayHandleUrl.URL_PayHandle_aliOfflinePay)
    public Result aliOfflinePay(@RequestBody TradeRecordRequest request) ;

    @PostMapping(PayHandleUrl.URL_PayHandle_getAlipayAuthInfo)
    public Result getAlipayAuthInfo(@RequestBody  AlipayAuthInfoRequest request);


    @PostMapping(PayHandleUrl.URL_getPointMeal)
    public Result getPointMeal(@RequestBody GetPointMealRequest request);


    //现金支付
    @PostMapping(PayHandleUrl.cashPay)
    public Result cashPayDiches(@RequestBody CashPayRequest request) ;


//    //查询餐段订餐信息
//    @PostMapping(PayHandleUrl.URL_getOrderListByMeal)
//    public Result getOrderListByMeal(@RequestBody GetOrderListByMealRequest request);

    //核销
    @PostMapping(PayHandleUrl.URL_orderVerification)
    public Result orderVerification(@RequestBody OrderVerificationRequest request) ;

    @PostMapping(value = PayHandleUrl.URL_saveXfRecordD)
    public Result saveXfRecordD(@RequestBody TradeRecordRequest request) ;

    @PostMapping(PayHandleUrl.getPayCardC)
    public Result onlinePayCard(@RequestBody QrCardPayRequest request) ;

    //随机选择灰度or正式
    @PostMapping(PayHandleUrl.URL_chooseClient)
    public  Integer chooseClient();

    /**
     * 2.4.12在线补缴订单查询（onlineRepairQuery）
     */
    @PostMapping(value = PayHandleUrl.URL_onlineRepairQuery)
    public RespMachMessage onlineRepairQuery(@RequestBody OnlineRepairQueryRequest request);

    //2.4.11 代扣补缴（backPay）
    @PostMapping(PayHandleUrl.URL_PayHandle_backPay)
    public Result backPay(@RequestBody BackPayRequest request) ;


    @PostMapping(value = PayHandleUrl.URL_updateXfFace)
    public RespMachMessage updateXfFace(@RequestBody EntityXfRecord entityXfRecord);


    /**
     * 获取微信公话参数
     */
    @PostMapping(value = PayHandleUrl.URL_getWxGhParam)
    public Result getWxGhParam(@RequestBody GetWxGhParamRequest request);

    //视频通话
    @PostMapping(PayHandleUrl.URL_consTypeConfig)
    public Result consTypeConfig(@RequestBody ConsTypeConfigRequest request) ;

    @PostMapping(PayHandleUrl.URL_PayHandle_staticCodePay)
    public Result staticCodePay(@RequestBody StaticCodePayRequest request);
}

